﻿
    using Maticsoft.BLL;
    using Maticsoft.DBUtility;
    using Maticsoft.Model;
    using System;
    using System.Data;
    using System.Text;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using Wuqi.Webdiyer;

public partial class WebPage_Diaocha_Fankui_Xiangqing_Content : SystemBBasePage
    {
   
        private Maticsoft.BLL.UserInfo userbll = new Maticsoft.BLL.UserInfo();
        private Maticsoft.Model.UserInfo usermodel = new Maticsoft.Model.UserInfo();
        private Maticsoft.BLL.vote_feedback_input vfbs = new Maticsoft.BLL.vote_feedback_input();
        private Maticsoft.BLL.vote_feedback_question vfq = new Maticsoft.BLL.vote_feedback_question();
        private Maticsoft.Model.vote_options vop = new Maticsoft.Model.vote_options();
        private Maticsoft.BLL.vote_options vops = new Maticsoft.BLL.vote_options();
        private Maticsoft.Model.vote_question voq = new Maticsoft.Model.vote_question();
        private Maticsoft.BLL.vote_question voqs = new Maticsoft.BLL.vote_question();

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            this.getContent();
        }

        private void getContent()
        {
            this.getValue();
            this.getTitle();
            this.voq = this.voqs.GetModel(int.Parse(base.Request.QueryString["xiangqing"].ToString()));
            this.vop = this.vops.GetModel(int.Parse(base.Request.QueryString["content"].ToString()));
            string wherestr = string.Concat(new object[] { "feedback_id in (select feedback_id from vote_feedback_question where options_id=", this.vop.id, " and question_id=", this.voq.id, ")" });
            Pagers pagers = DbHelperSQL.SelectByPager("*", wherestr, "Id desc", this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize, "vote_feedback_input", "", "");
            if ((pagers != null) && (pagers.MyData.Rows.Count > 0))
            {
                this.AspNetPager1.RecordCount = pagers.TotalRecords;
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < pagers.MyData.Rows.Count; i++)
                {
                    DataRow row = pagers.MyData.Rows[i];
                    if ((i % 2) != 0)
                    {
                        builder.Append("<tr>");
                    }
                    else
                    {
                        builder.Append("<tr class='alt'>");
                    }
                    builder.Append("<td>" + row["Id"] + "</td>");
                    this.usermodel = this.userbll.GetModel(Convert.ToInt32(row["feedback_id"].ToString()));
                    if (this.usermodel != null)
                    {
                        builder.Append("<td>" + this.usermodel.Username + "</td>");
                    }
                    else
                    {
                        builder.Append("<td>&nbsp;</td>");
                    }
                    builder.Append("<td>" + row["value"] + "</td>");
                    builder.Append("</tr>");
                }
                this.Literal5.Text = builder.ToString();
            }
        }

        private void getTitle()
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("<tr>");
            builder.Append("<th style='width:100px;'>ID</th>");
            builder.Append("<th style='width:300px;'>用户名</th>");
            builder.Append("<th style='width:400px;'>提交的内容</th>");
            builder.Append("</tr>");
            this.Literal4.Text = builder.ToString();
        }

        private void getValue()
        {
            StringBuilder builder = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            this.voq = this.voqs.GetModel(int.Parse(base.Request.QueryString["xiangqing"].ToString()));
            this.vop = this.vops.GetModel(int.Parse(base.Request.QueryString["content"].ToString()));
            if (this.voq != null)
            {
                builder.Append("<h2>”" + this.voq.Title + "“</h2>");
            }
            if (this.vop != null)
            {
                builder2.Append("<h3>" + this.vop.name + "</h3>");
            }
            this.Literal1.Text = builder.ToString();
            this.Literal2.Text = builder2.ToString();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.HeaderControl1.Select = "diaocha";
            this.DiaoCha1.Select = "Fankui";
            this.getContent();
        }
    }
